package org.objective.dal.loader;

import org.common.service.ServiceRegister;
import org.objective.base.BaseFieldInfo;
import org.objective.base.BaseObjectInfo;
import org.objective.base.BaseType;
import org.objective.base.BaseTypeInfo;
import org.objective.command.AuthToken;
import org.objective.command.Command;
import org.objective.dal.commands.CheckExistTypeCommand;
import org.objective.dal.commands.LoadFieldInfoCommand;
import org.objective.service.Loader;



/**
 *
 * @author gus
 */
class LoaderImplement implements Loader
{
    private ServiceRegister register;

    LoaderImplement(ServiceRegister instance)
    {
        this.register = instance;
    }

    @Override
    public Boolean existType(BaseType type) throws Exception
    {
        Command<Boolean> cmd = new CheckExistTypeCommand(type.getUID());
        return cmd.execute(register, new AuthToken()).getValue();
    }

    @Override
    public BaseFieldInfo getField(long fieldId) throws Exception
    {
        Command<BaseFieldInfo> cmd = new LoadFieldInfoCommand(fieldId);
        return cmd.execute(register, new AuthToken()).getValue();
    }

    @Override
    public BaseObjectInfo getObject(long id) throws Exception
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public BaseTypeInfo getType(long id) throws Exception
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public long[] loadFieldIDList(long id) throws Exception
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
